﻿Public Class frmE_liquidacion
    Dim liq As New clsLiquidacion
    Sub Actualizar()
        Dim intFolio As Integer = 0
        If Me.txtFolio.Text <> "" Then
            intFolio = Me.txtFolio.Text
            liq.IdLiquidacion = Me.txtFolio.Text
        Else
            intFolio = 0
            liq.IdLiquidacion = 0

        End If
        liq.Buscar()
        Scatter()
        Me.txtFolio.Text = intFolio
        liq.IdLiquidacion = Me.txtFolio.Text
    End Sub
    Private Sub Scatter()
        datFecha.Value = liq.Fecha
        txtCodigoLiquidador.Text = liq.CodigoLiquidador
        txtAnalista.Text = liq.NombreLiquidador
        txtCodigoOperador.Text = liq.CodigoOperaor
        txtOperador.Text = liq.NombreOperador
        txtAutobus.Text = liq.NoEconomico
        txtCidClien01.Text = liq.IdAutobus
        txtRuta.Text = BuscarStrDatoCitra("Rutas", "cCodigoV01", "Nombre='" & liq.NombreRuta & "'")
        If liq.TipoLiquidacion = 0 Then
            radioPreLiquidacion.Checked = True
        Else
            radioLiquidacion.Checked = True
        End If
        txtSerie.Text = liq.Serie
        txtInicial.Text = liq.NumeracionInicial
        txtFinal.Text = liq.NumeracionFinal
        txtTotalBoletos.Text = liq.TotalBoletos
        txtPagobus.Text = liq.Preferencial
        txtPagobusPendiente.Text = liq.General
        txtVueltas.Text = liq.Vueltas
        txtTotal.Text = liq.Liquidacion

        txtCidBoleto.Text = BuscarIntDatoCitra("Kardex", "IdBoleto", "IdAutobus=" & txtCidClien01.Text & " and Serie='" & txtSerie.Text & "'")

        TotalLiquidacion()
    End Sub
    Sub TotalLiquidacion()
        Dim FechaLiquidacion As String = datFecha.Value.ToString("MM/dd/yyyy")
        txtTotalLiquidaciones.Text = BuscarIntDatoCitra("SELECT COUNT(*) FROM Liquidacion WHERE convert(varchar,fecha,101)='" & FechaLiquidacion & "'")
    End Sub

    Private Sub frmE_liquidacion_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ToolStrip1.Cursor = Cursors.Hand
        ToolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System

        Actualizar()

    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        Close()

    End Sub
End Class